package com.noahplat.alarm;

import com.noahplat.common.utils.DateUtil;
import com.noahplat.common.utils.FeignInterceptor;
import com.noahplat.common.utils.JpushUtils;
import com.noahplat.common.utils.RedisUtils;
import feign.RequestInterceptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import tk.mybatis.spring.annotation.MapperScan;

/**
 * 作者：李景星
 * 描述：报警微服务启动类
 * 时间：2020-10-23
 */
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
@EnableDiscoveryClient
@EnableFeignClients(basePackages = {"com.noahplat.user.feign","com.noahplat.person.feign"})   //启动feign扫描
@MapperScan("com.noahplat.alarm.mapper")
public class AlarmApplication {
    public static void main(String[] args) {
        SpringApplication.run(AlarmApplication.class, args);
    }

    /**
     * 注入redis工具类
     * @return
     */
    @Bean
    public RedisUtils getRedisUtils(){
        return new RedisUtils();
    }

    /**
     * 注入极光推送工具类
     * @return
     */
    @Bean
    public JpushUtils getJpushUtils(){
        return new JpushUtils();
    }

    /**
     * 注入时间处理工具类
     * @return
     */
    @Bean
    public DateUtil getDateUtil(){
        return new DateUtil();
    }

    /*feign远程调用配置header中的token*/
    @Bean
    public RequestInterceptor feignInterceptor(){
        return new FeignInterceptor();
    }
}

